home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / tcp_ip / ka9q / kit_src / mk_dom.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-03  |  1.0 KB  |  39 lines

  1. /*    (C) Copyright 1991 Dave Fritsche (wb8zxu), All Rights Reserved.
  2.  * 
  3.  *    Redistribution and use in source and binary forms are permitted for
  4.  *    non-commercial use, provided that the above copyright notice and this
  5.  *    paragraph are duplicated in all such forms.  THIS SOFTWARE IS PROVIDED
  6.  *    ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
  7.  *    WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
  8.  *    FITNESS FOR A PARTICULAR PURPOSE.
  9.  */
  10. #include <stdio.h>
  11. #include "screen.h"
  12.  
  13. mk_domain(fnm)
  14. unsigned char fnm[];
  15. {
  16.     FILE *domain;
  17.     unsigned char buf[128];
  18.  
  19.     sprintf(buf, "%s\\%s", path, fnm);
  20.     if (debug)
  21.     {
  22.         printf("***> domain.txt file (%s):\n", buf);
  23.         domain = stdout;
  24.     }
  25.     else
  26.         if ( (domain = fopen(buf, "a")) == NULL )
  27.         {
  28.             printf("\nCan't open \"%s\" for write, aborting!\n\n", buf);
  29.             exit(-1);
  30.         }
  31.  
  32.     fprintf(domain, "%s.\tIN\tA\t%ld.%ld.%ld.%ld\n", callsign,
  33.         ((ip >> 24) & 0xff), ((ip >> 16) & 0xff), ((ip >> 8) & 0xff),
  34.         (ip & 0xff) );
  35.  
  36.     if (!debug)
  37.         fclose(domain);
  38. }
  39.